/*
 * @Descripttion:
 * @Author: zheng xinyi
 * @Date: 2024-05-10 09:31:55
 * @LastEditors: zheng xinyi
 * @LastEditTime: 2024-05-11 17:17:26
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import eslint from '@nabla/vite-plugin-eslint'
import { resolve } from 'path'
import AutoImport from 'unplugin-auto-import/vite'
import VueDevTools from 'vite-plugin-vue-devtools'
// https://vitejs.dev/config/
export default defineConfig({
	base: './',
	plugins: [
		VueDevTools(),
		vue(),
		eslint(),
		AutoImport({
			imports: ['vue', 'vue-router']
		})
	],
	css: {
		preprocessorOptions: {
			// scss: {
			// 	additionalData: '@import "@/assets/scss/index.scss";'
			// }
		}
	},
	server: {
		host: '0.0.0.0',
		port: 8080, // 端口
		hmr: true,
		proxy: {
			'/backend': {
				// 请求接口中要替换的标识
				target: 'http://localhost:6060', // 代理地址
				changeOrigin: true, // 是否允许跨域
				secure: true
			}
		}
	},
	resolve: {
		alias: {
			'@': resolve(__dirname, './src'),
			'*': resolve('')
		}
	}
})
